<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>忘忧网后台</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="../Xadmin/css/xadmin.css">
    <link rel="stylesheet" href="../Xadmin/css/login.css">
    <link rel="stylesheet" href="../Xadmin/css/font.css">
    <script src="../layui/layui.js" charset="utf-8"></script>
    <script src="../JS/BaseJS.js" charset="utf-8"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div style="display: flex;flex-direction: column;margin-left: 100px">
    对应音乐:
    <div class="layui-inline">
        <input class="layui-input" id="mid" autocomplete="off" style="width: 400px"/>
        <button class="layui-btn layui-btn-sm" onclick="Chose()">选择</button>
    </div>
    视频文件:
    <div class="layui-inline">

        <input class="layui-input" id="MovieFile" type="file" autocomplete="off" style="width: 400px"/>
    </div>
    视频图片:
    <div class="layui-inline">
        <input class="layui-input" id="MImageFile" type="file" autocomplete="off" style="width: 400px"/>
    </div>
    Mv名称:
    <div class="layui-inline">
        <input class="layui-input" id="MvName" autocomplete="off"  style="width: 400px"/>
    </div>
    Mv时长:
    <div class="layui-inline">
        <input class="layui-input" id="Mvt" autocomplete="off" style="width: 400px"/>
    </div>
    Mv介绍:
    <div class="layui-inline">
        <input class="layui-input" id="MvInfo" autocomplete="off" style="width: 400px"/>
    </div>
    <button class="layui-btn" data-type="reload" onclick="AddUser()" style="width: 200px;margin-left: 100px;margin-top: 20px">添加</button>
</div>
</body>
<script>
    var layer
    layui.use('layer',function () {//导入layer组件
        layer = layui.layer
    })
    $(function(){//页面加载
        $("#mid").val(localStorage.getItem("mid1"))
    } )
    function  AddUser(){//修改用户信息
        var files = $('#MovieFile')[0].files;
        var files1 = $('#MImageFile')[0].files;
        var obj = {
            mid:$("#mid").val(),
            MvName:$("#MvName").val(),
            Mvt:$("#Mvt").val(),
            MvInfo:$("#MvInfo").val(),
            mfile:files[0],
            ifile:files1[0]
        }
        console.log(obj);
        var fromData = new FormData();
        $.each(obj,function(key,value) {
            fromData.append(key,value);
        })
        $.ajax({
            url:BaseUrl+"Movie/Movie",
            method:"post",
            cache: false,
            contentType: false,
            processData: false,
            data:fromData
           ,success:function (res){
                var object = JSON.parse(res)
                layer.alert(object.msg)
            }

        })
    }
    function Chose(){
        window.location.href="choseMusic.html"
    }
</script>
</html>